<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos -->
			<title>Docs for page SavvyHelper.php</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
		</head>
		<body>
			<div class="page-body">			
<h2 class="file-name">/C:/SavvyHelper.php</h2>

<a name="sec-description"></a>
<div class="info-box">
	<div class="info-box-title">Description</div>
	<div class="nav-bar">
					<span class="disabled">Description</span> |
							<a href="#sec-classes">Classes</a>
			|													<a href="#sec-functions">Functions</a>
			</div>
	<div class="info-box-body">	
		<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">SavvyHelper, a group of helpers for symfony framework.</p>
<p class="description"><p>SavvyHelper includes a lot of useful helpers for your almost daily work  in any web applications. Helpers included:  <ul><li>Simple Dynamic HTML Table</li><li>Simple Edit Form</li><li>Save Form</li><li>Simple Delete Form</li></ul></p></p>
	<ul class="tags">
				<li><span class="field">version:</span> 1.0</li>
				<li><span class="field">author:</span> Ahmed El.Hussaini &lt;<a href="mailto:satisfaction144@yahoo.com">satisfaction144@yahoo.com</a>&gt;</li>
			</ul>
		
			</div>
</div>
		
	<a name="sec-classes"></a>	
	<div class="info-box">
		<div class="info-box-title">Classes</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
			<span class="disabled">Classes</span>
			|																<a href="#sec-functions">Functions</a>
					</div>
		<div class="info-box-body">	
			<table cellpadding="2" cellspacing="0" class="class-table">
				<tr>
					<th class="class-table-header">Class</th>
					<th class="class-table-header">Description</th>
				</tr>
								<tr>
					<td style="padding-right: 2em; vertical-align: top">
						<a href="../default/FieldsHelper.html">FieldsHelper</a>
					</td>
					<td>
											
										</td>
				</tr>
								<tr>
					<td style="padding-right: 2em; vertical-align: top">
						<a href="../default/FormElements.html">FormElements</a>
					</td>
					<td>
											
										</td>
				</tr>
							</table>
		</div>
	</div>

	
	
	
	<a name="sec-functions"></a>	
	<div class="info-box">
		<div class="info-box-title">Functions</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
							<a href="#sec-classes">Classes</a>
				|															<span class="disabled">Functions</span>
		</div>
		<div class="info-box-body">	
			<a name="functiongetDeleteTable" id="functiongetDeleteTable"><!-- --></a>
<div class="oddrow">
	
	<div>
		<span class="method-title">getDeleteTable</span> (line <span class="line-number">187</span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">A function the displays a vertical table containing the model to be deleted.</p>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			getDeleteTable
		</span>
					(<span class="var-type">object</span>&nbsp;<span class="var-name">$model</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$confirmMsg</span>, <span class="var-type">array</span>&nbsp;<span class="var-name">$attributes</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">object</span>
				<span class="var-name">$model</span><span class="var-description">: The model object to be deleted</span>			</li>
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$confirmMsg</span><span class="var-description">: The confirmation message displayed right before deleting the object</span>			</li>
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$attributes</span><span class="var-description">: An array containing html attributes, currently use only the action attribute</span>			</li>
				</ul>
		
	
</div>
<a name="functiongetEditForm" id="functiongetEditForm"><!-- --></a>
<div class="evenrow">
	
	<div>
		<span class="method-title">getEditForm</span> (line <span class="line-number">128</span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">A function that generate an HTML dynamic edit form for a model object.</p>
<p class="description"><p>Examples: Displays a form that contains all fields except primary and foreign keys. Only the &quot;Title&quot; and &quot;Name&quot; are editable.  <div class="src-code"><ol><li><div class="src-line">&nbsp;<span class="src-php">&lt;?php&nbsp;</span>echo&nbsp;<a href="../default/_.html#functiongetEditForm">getEditForm</a><span class="src-sym">(</span><span class="src-var">$project</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'getTitle'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'getName'</span><span class="src-sym">)</span><span class="src-sym">,&nbsp;</span><span class="src-id">null</span><span class="src-sym">)&nbsp;</span><span class="src-php">?&gt;</span></div></li>
</ol></div></p></p>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			getEditForm
		</span>
					(<span class="var-type">object</span>&nbsp;<span class="var-name">$model</span>, <span class="var-type">array</span>&nbsp;<span class="var-name">$editableMethods</span>, <span class="var-type">array</span>&nbsp;<span class="var-name">$attributes</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">object</span>
				<span class="var-name">$model</span><span class="var-description">: The model to be updated</span>			</li>
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$editableMethods</span><span class="var-description">: The fields to be edited, by default all fields are disabled</span>			</li>
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$attributes</span><span class="var-description">: HTML attributes</span>			</li>
				</ul>
		
	
</div>
<a name="functiongetSimpleTable" id="functiongetSimpleTable"><!-- --></a>
<div class="oddrow">
	
	<div>
		<span class="method-title">getSimpleTable</span> (line <span class="line-number">57</span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">A function that generates an HTML dynamic table using an array containing a collection of model objects.</p>
<p class="description"><p>Consider this, we have a table in a database that consists of the following fields (id, title, name, email, address, phone, login_id).</p><p>Examples:</p><p>The first paramter <strong>$model</strong> is an array that contains a collection of model objects.  The second parameter, if it's null, all fields will be displayed except the primary and foreign keys, if it's an array, it must be a list of getter methods of the fields to be displayed.</p><p>The third parameter is an array, first key; <strong>&quot;routing-params&quot;</strong> specifies the parameters to be passed to the desired routing rules.</p><p>For example, say you have a routing rule <strong>&quot;@edit&quot;</strong> that  you use to edit records from the current table, and this rule expects 2 parameters to be passed to it, <strong>&quot;title&quot;</strong> and <strong>&quot;name&quot;</strong>. So we define the parameters name and value using the  <strong>&quot;routing-params&quot;</strong> array</p><p><strong>Displaying all fields with manage links</strong>  <div class="src-code"><ol><li><div class="src-line">&nbsp;<span class="src-php">&lt;?php&nbsp;</span>echo&nbsp;<a href="../default/_.html#functiongetSimpleTable">getSimpleTable</a><span class="src-sym">(</span><span class="src-var">$myModel</span><span class="src-sym">,&nbsp;</span><span class="src-id">null</span><span class="src-sym">,</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'routing-params'</span>=&gt;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'title'</span>=&gt;<span class="src-str">'getTitle'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'name'</span>=&gt;<span class="src-str">'getName'</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">'@edit'</span>=&gt;<span class="src-str">'Edit'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'@delete'</span>=&gt;<span class="src-str">'Delete'</span><span class="src-sym">))&nbsp;</span><span class="src-php">?&gt;</span></div></li>
</ol></div></p><p><strong>Displaying all fields without manage links</strong>  <div class="src-code"><ol><li><div class="src-line">&nbsp;<span class="src-php">&lt;?php&nbsp;</span>echo&nbsp;<a href="../default/_.html#functiongetSimpleTable">getSimpleTable</a><span class="src-sym">(</span><span class="src-var">$myModel</span><span class="src-sym">,&nbsp;</span><span class="src-id">null</span><span class="src-sym">,&nbsp;</span><span class="src-id">null</span><span class="src-sym">)&nbsp;</span><span class="src-php">?&gt;</span></div></li>
</ol></div></p><p><strong>Displaying selected fields only</strong>  <div class="src-code"><ol><li><div class="src-line">&nbsp;<span class="src-php">&lt;?php&nbsp;</span>echo&nbsp;<a href="../default/_.html#functiongetSimpleTable">getSimpleTable</a><span class="src-sym">(</span><span class="src-var">$myModel</span><span class="src-sym">,</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'getTitle'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'getName'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'getEmail'</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'routing-params'</span>=&gt;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'title'</span>=&gt;<span class="src-str">'getTitle'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'name'</span>=&gt;<span class="src-str">'getName'</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">'@edit'</span>=&gt;<span class="src-str">'Edit'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'@delete'</span>=&gt;<span class="src-str">'Delete'</span><span class="src-sym">))&nbsp;</span><span class="src-php">?&gt;</span></div></li>
</ol></div></p></p>
	
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			getSimpleTable
		</span>
					(<span class="var-type">object|array</span>&nbsp;<span class="var-name">$model</span>, <span class="var-type">array</span>&nbsp;<span class="var-name">$displayMethods</span>, <span class="var-type">array</span>&nbsp;<span class="var-name">$routingRules</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">object|array</span>
				<span class="var-name">$model</span><span class="var-description">: The Model to be displayed</span>			</li>
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$displayMethods</span><span class="var-description">: A list of getter methods. If used, only the fields whose methods were passed will be displayed in the genereated table</span>			</li>
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$routingRules</span><span class="var-description">: A list of routing rules with text labels to be used when displaying links to edit or delete in the generated table</span>			</li>
				</ul>
		
	
</div>
<a name="functionsaveFormData" id="functionsaveFormData"><!-- --></a>
<div class="evenrow">
	
	<div>
		<span class="method-title">saveFormData</span> (line <span class="line-number">175</span>)
	</div> 

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">A function that saves a form data to a model object and then to the database, after saving the data  a message is added to the request, so you can display it.</p>
<p class="description"><p><div class="src-code"><ol><li><div class="src-line">&nbsp;<span class="src-php">&lt;?php&nbsp;</span><a href="../default/_.html#functionsaveFormData">saveFormData</a><span class="src-sym">(</span><span class="src-var">$model</span><span class="src-sym">,&nbsp;</span><span class="src-var">$sf_request</span><span class="src-sym">,&nbsp;</span><span class="src-str">'Item&nbsp;Deleted'</span><span class="src-sym">)&nbsp;</span><span class="src-php">?&gt;</span></div></li>
</ol></div>  The 'Item Deleted' can be displayed anywhere you want, it's up to you really</p></p>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			saveFormData
		</span>
					(<span class="var-type">object</span>&nbsp;<span class="var-name">$model</span>, <span class="var-type"></span>&nbsp;<span class="var-name">$request</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$msg</span>)
			</div>

			<ul class="parameters">
					<li>
				<span class="var-type">object</span>
				<span class="var-name">$model</span><span class="var-description">: The model object that will be updated with the form data</span>			</li>
					<li>
				<span class="var-type">sfRequest</span>
				<span class="var-name">$request</span><span class="var-description">: A reference to the current request object</span>			</li>
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$msg</span><span class="var-description">: The message to be displayed</span>			</li>
				</ul>
		
	
</div>
		</div>
	</div>
	
	<p class="notes" id="credit">
		Documentation generated on Sun, 27 May 2007 22:20:01 +0300 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.1</a>
	</p>
	</div></body>
</html>